﻿/*绝版点装*/
var status = 0;
var choice;
var itemxh=new Array("1115005","1112192","1115008","1112195","1115009","1112196","1115007","1112194","1112103","1112100","1112134","1112135","1112136","1112141","1112142","1112143","1112145","1112146","1112148","1112149","1112144","1112150","1112154","1112151","1112152","1112153","1112155","1112156","1112157","1112158","1112159","1112160","1112161","1112162","1112163","1112164","1112165","1112166","1112171","1112172","1112173","1112176","1112178","1112180","1112182","1112179","1112181","1112191","1112190","1112237","1112238","1112254","1112256","1112262","1112266","1112263","1112264","1112265","1112267","1112268","1112269","1112270","1112271","1112272","1112273","1112282","1112274","1112277","1112278","1112283","1112284","1112285","1112288","1112291","1112294","1112296","1115004","1115003","1112253","1112258","1112259","1112260","1112261","1112290","1112292","1112293","1112295","1112289","1112170","1112161","1112174","1112175","1112286","1112287","1112177");
var itemxhcost=new Array("80000","80000","80000","80000","80000","80000","80000","80000","30000","30000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","60000","100000","100000","100000","100000","60000");

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) cm.dispose();
    else {
        if (status == 0 && mode == 0) {
            cm.dispose();
            return;
        } else if (status >= 1 && mode == 0) {
            cm.sendOk("好吧，欢迎下次继续光临！.");
            cm.dispose();
            return;
        }
        if (mode == 1) status++;
        else status--;

        if (status == 0) {
            choices = "\r\n#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#亲爱的#r#h ##k您好，请选择您希望购买的现金装备";
            for (var i = 0; i < itemxh.length; i++) {
                choices += "\r\n#L" + i + "##v" + itemxh[i] + "##z" + itemxh[i] + "#　#d需要#r" + itemxhcost[i] + "#d点卷#k#l";
            }
            cm.sendSimpleS("#fUI/UIWindow2.img/Quest/quest_info/summary_icon/summary#" + choices,2);
        } else if (status == 1) {
                cm.sendGetNumber("你选择的商品为#v" + itemxh[selection] + "#售价为：" + itemxhcost[selection] + "点卷/张\r\n请输入你购买的数量",1,1,cm.getPlayer().getCSPoints(1));
		choice = selection;
        } else if (status == 2) {
            fee = selection;
            money = fee*itemxhcost[choice];
            if (fee < 0) {
            cm.sendOk("不能输入0.或者你没有足够的点卷支付你要买的数量.!");
            cm.dispose();
            } else if (cm.getPlayer().getCSPoints(1) < money) {
            cm.sendOk("购买失败，你没有" + money + "点卷");
            cm.dispose();
            } else {
			cm.gainNX(-money);
            cm.gainItem(itemxh[choice], fee);
            cm.sendOk("恭喜，购买成功。");
            cm.dispose();
             }
        }
    }
}
